<?php

namespace Constructor;

class Instances extends AbstractInstances
{
    public function get( $identifier = NULL )
    {
        if( is_null( $identifier ) OR ! is_string( $identifier ) ) 
        {
            throw new BaseValueException( 'identifier', $identifier, 'string' );
        }
        
        return parent::get( $identifier );
    }
    
    public function reset() { $this->containerInstances->reset(); }
    public function count() { return $this->containerInstances->count(); }
    public function getIdentifiers() { return $this->containerInstances->getIdentifiers(); }
    public function set( $instance, $identifier = NULL ) 
    { 
        if( is_null( $instance ) OR ! is_object( $instance ) ) 
        {
            throw new BaseValueException( 'instance', $instance, 'object' );
        }
        
        return parent::set( $instance, $identifier );
    }
    
    public function has( $identifier ) 
    { 
        if( ! is_string( $identifier ) OR is_null( $identifier ) ) 
        {
            throw new BaseValueException( 'identifier', $identifier, 'string' );
        }
        
        return parent::has( $identifier );
    }
    
    public function create( $identifier = NULL, array $aliases = array() ) 
    { 
        if( ! is_string( $identifier ) OR is_null( $identifier ) ) 
        {
            throw new BaseValueException( 'identifier', $identifier, 'string' );
        }
        
        return parent::create( $identifier, $aliases );
    }
}
